From: Lars Magne Ingebrigtsen Date: Fri, 16 Aug 2013 15:10:13 +0000 (+0200) Subject: (imagemagick_get_animation_cache): Fix a double-free error. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~3275^2~198 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=8a6f875f7e613b2910ed3355ce0f2c01fa43cb9b;p=emacs.git (imagemagick_get_animation_cache): Fix a double-free error. --- diff --git a/src/ChangeLog b/src/ChangeLog index d5c97748d1a..de9724238a0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2013-08-16 Lars Magne Ingebrigtsen * image.c: Implement an ImageMagick per-image cache. + (imagemagick_get_animation_cache): Fix a double-free error. 2013-08-16 Xue Fuqiao diff --git a/src/image.c b/src/image.c index 082cc6a762a..ed10a3ed6cd 100644 --- a/src/image.c +++ b/src/image.c @@ -7901,9 +7901,9 @@ void imagemagick_prune_animation_cache () { struct animation_cache *cache = animation_cache; - struct animation_cache *prev; + struct animation_cache *prev = NULL; EMACS_TIME old = sub_emacs_time (current_emacs_time (), - EMACS_TIME_FROM_DOUBLE (60)); + EMACS_TIME_FROM_DOUBLE (5)); while (cache) { @@ -7920,17 +7920,18 @@ imagemagick_prune_animation_cache () cache = cache->next; free (this_cache); } - else { - prev = cache; - cache = cache->next; - } + else + { + prev = cache; + cache = cache->next; + } } } struct animation_cache * imagemagick_get_animation_cache (MagickWand *wand) { - char *signature = MagickGetImageSignature (wand); + char *signature = xstrdup (MagickGetImageSignature (wand)); struct animation_cache *cache = animation_cache; imagemagick_prune_animation_cache ();